import localrequest from './localrequest'
// 获取分类列表
export function getCategoryList () {
  return localrequest({
    url: '/product/getBaseCategoryList',
    method: 'GET'
  })
}
// 获取排行列表
export function getRank () {
  return localrequest({
    url: '/goods/getRank',
    method: 'post'
  })
}
// 获取猜你喜欢
export function getGuessLike () {
  return localrequest({
    url: '/goods/guessLike',
    method: 'post'
  })
}
// 获取底部floor
export function getFloor () {
  return localrequest({
    url: '/goods/getFloor',
    method: 'post'
  })
}
// search区
export function searchResult (query) {
  return localrequest({
    url: '/product/list',
    method: 'post',
    data: query || {}
  })
}
// login区
export function login (data) {
  return localrequest({
    method: 'post',
    url: '/goods/login',
    data: {
      phone: data.user,
      password: data.Pass
    }
  })
}
// register注册区
export function register (data) {
  return localrequest({
    method: 'post',
    url: '/goods/register',
    data: data
  })
}
// 获取Goods商品
export function getGoods (value) {
  return localrequest({
    url: `/product/item/${value}`,
    method: 'get'

  })
}
// 获取用户信息
export function getSelf () {
  return localrequest({
    url: '/user/getSelf',
    method: 'post'
  })
}
// 获取购物车数据
export function getShoppingCar () {
  return localrequest({
    url: '/user/getShoppingCar',
    method: 'get'
  })
}
// 添加到购物车
export function addShoppingCar (goods) {
  return localrequest({
    url: '/user/addshoppingCar',
    method: 'post',
    data: goods
  })
}
// 删除购物车商品
export function removeGoods (id) {
  return localrequest({
    method: 'post',
    url: '/user/removeGoods',
    data: { id: id }
  })
}
// 修改商品个数
export function updateGoods (item) {
  return localrequest({
    method: 'post',
    url: '/user/updateGoods',
    data: item
  })
}
